<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<style>
.content .main-content {
    width: 1000px;
    margin-left: 20px;
    margin-bottom: 10px;
    padding-left: 10px;
    border:none;
}
.submitBtn{
	color: #fff !important;
}

.inferiorTable th {
    width: auto!important;
    text-align: -internal-center;
    text-align: center;
    font-weight: normal;
    font-size: 14px;
}

#subReport thead tr th{
	border-bottom: #ddd !important;
}

#subReport tbody tr td{
	/* border: 1px solid #ddd; */
} 

.newTab a{
	cursor: pointer;
}

.searchDetail .table{
	 border: none;
}
</style>
<!-- 下级报表新页面 -->
<section data-v-c2f0218a="" class="main-content subReportNew view">
	<div data-v-eea26fd8="" class="userTitle mgb10">
		下级报表
	</div>
	 <input data-v-eea26fd8="" type="text" placeholder="请输入下级账号" class="userInput">&nbsp;
	<a data-v-eea26fd8="" class="submitBtn ClickShade">搜索</a>
	<div data-v-eea26fd8="" id="timeType" class="newTab">
		<a data-v-eea26fd8="" class="curr">今天</a>
		<a data-v-eea26fd8="" class="">昨天</a>
		<a data-v-eea26fd8="" class="">七天</a>
	</div>
	<div data-v-eea26fd8="" class="userMainH mgb10">
		<div data-v-eea26fd8="" class="searchDetail">
			<table data-v-eea26fd8="" class="inferiorTable table" id="subReport">
				<thead data-v-eea26fd8="">
					<tr data-v-eea26fd8="">
						<th data-v-eea26fd8="">账号</th>
						<th data-v-eea26fd8="">等级</th>
						<th data-v-eea26fd8="">充值金额</th>
						<th data-v-eea26fd8="">提现金额</th>
						<th data-v-eea26fd8="">投注金额</th>
						<th data-v-eea26fd8="">中奖金额</th>
						<th data-v-eea26fd8="">棋牌盈亏</th>
						<th data-v-eea26fd8="">返点佣金</th>
						<th data-v-eea26fd8="">活动礼金</th>
						<th data-v-eea26fd8="">个人盈亏</th>
					</tr>
				</thead>
				<tbody data-v-eea26fd8="">
					<!-- <tr data-v-eea26fd8="" style="border-bottom: 0px;">
						<td data-v-eea26fd8="" colspan="100">
							<div data-v-eea26fd8="" class="notContent" style="padding: 100px 0px;"><i data-v-eea26fd8="" class="defFont"></i>暂无记录</div>
						</td>
					</tr> -->
				</tbody>
			</table>
		</div>
		<!-- <div data-v-eea26fd8="" class="page">
			<p data-v-eea26fd8="">共<em data-v-eea26fd8="">0</em>条记录</p>
			<div data-v-eea26fd8="" id="pageNav" class="pageNav">
				<div data-v-eea26fd8="" id="pageNav" class="pageNav">
					<ul class="pagination" style="display: none;">
						<li style="display: none;">
							<a>上一页</a>
						</li>
						<li style="display: none;">
							<a>下一页</a>
						</li>
					</ul>
				</div>
			</div>
		</div> -->
	</div>
                    
</section>
<script type="text/javascript">
	var agentName=$(".userName").text();
	var time=GetDateStr(0);
	var datatable;
	/* 下级报表的数据 */
	function datatable01(){
		datatable=$("#subReport").DataTable({
		    "bLengthChange": true,      
		    "bSort": false,
		    "bAutoWidth": false,
		    'aLengthMenu':[10],
		     "searching": false,
		     "dom": `ftp`,
		     "language": {
		          "lengthMenu": "每页显示 _MENU_ 条记录",     
		          "zeroRecords": "没有检索到数据",     
		          "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
		          "info": "没有数据",     
		          "oPaginate": {     
		              "sFirst": "首页",     
		              "sPrevious": "前一页",     
		              "sNext": "后一页",     
		              "sLast": "尾页"    
		        	},
		          "search":"搜索:",
		          "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
		          "infoEmpty":      "没有找到匹配的信息",
		       },
		       "columnDefs": [{"defaultContent": "",
	               "targets": "_all"}],
		       "ajax": {
		      	 "type": "POST",
		      	 "url":"/agent/findAgentSubordinateReport.do",
		      	"data": function ( d ) {
			        d.userName = $(".userInput").val();
			        d.time=time;
			        d.agentName=agentName;
	   		    },
		      	 "dataSrc": function(json) {
		      		 newData = json.data;
		      		 if(newData=="" &&  $(".userInput").val()!=""){
		      			$(".userInput").val("");
		      			 layer.alert("没有这个下级用户,请重新输入");
		      			 return;
		      		 }
		      		if(newData=="" && $(".userInput").val()==""){
		      			$("#subReport tbody").html('<tr data-v-eea26fd8="" style="border-bottom: 0px;">'+
								'<td data-v-eea26fd8="" colspan="100">'+
								'<div data-v-eea26fd8="" class="notContent" style="padding: 100px 0px;"><i data-v-eea26fd8="" class="defFont"></i>暂无记录</div>'+
							'</td>'+
						'</tr>')
		      		 }
		      		 for(i=0;i<newData.length;i++){
		      			 var item=newData[i];
		      			item.agent_grade+="级";
		      			item.one_recharge+="元";
		      			item.one_drawing+="元";
		      			item.one_betting+="元";
		      			item.one_award+="元";
		      			item.one_chessCard_total+="元";
		      			item.rebate_money+="元";
		      			item.one_activity+="元";
		      			item.one_whole_total+="元";
		      		 }
		      		 return newData;
		      	 },
		       },
		       "columns": [
		           { "data": "user_name","className":"user_name-td"},
		           { "data": "agent_grade","className":"agent_grade-td"},
		           { "data": "one_recharge","className":"one_recharge-td"},
		           { "data": "one_drawing","className":"one_drawing-td"},
		           { "data": "one_betting","className":"one_betting-td"},
		           { "data": "one_award","className":"one_award-td"},
		           { "data": "one_chessCard_total","className":"one_chessCard_total-td"},
		           { "data": "rebate_money","className":"rebate_money-td"},
		           { "data": "one_activity","className":"one_activity-td"},
		           { "data": "one_whole_total","className":"one_whole_total"},
	           ] 
		 	});
	}
	datatable01();
	
	/* 日期查询 */
	$(".newTab").on("click","a",function(){
		$(".newTab a").removeClass("curr");
		$(this).addClass("curr");
		var index=$(this).index();
		if(index==0){
			time=GetDateStr(0);
		}else if(index==1){
			time=GetDateStr(1);
		}else if(index==2){
			time=GetDateStr(7);
		}  
		datatable.destroy();
		datatable01();
	})
	
	/* 搜索查询 */
	$(".submitBtn").on("click",function(){
		datatable.destroy(); 
		datatable01();
	})
	
</script>
